package com.augurit.gis.flex;

import java.io.Serializable;
import java.util.List;





/**
 * <p>Title: 表单基类</p>
 * <p>Description: 抽象表单的基本属性</p>
 * @author 沈坚丰
 * @date 2009-05-04
 */

public class BaseForm  {
	
	/**
	 * 需要被删除的表单对象的ID列表
	 */
	private Serializable[] delId;
	
	/**
	 * 返回的url
	 */
	private String returnUrl;
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 每页记录数
	 */
	private int rowsPerPage = 20;

	/**
	 * 当前页
	 */
	private int currentPage = 1;

	/**
	 * 总记录数
	 */
	private int rowCount = 0;

	/**
	 * 总页数
	 */
	private int pageCount = 1;

	/**
	 * 第几行开始
	 */
	private int rowFrom = 0;

	/**
	 * 第几行结束
	 */
	private int rowTo = 0;

	/**
	 * 指获取所有记录
	 */
	public static int ALL_DATA = -1;
	
	
	/**
	 * 是否需要执行查询
	 */
	private String needToSearch = "1";
	
	private boolean needToLog = false;
	
	private UserForm userInfo;
	
	public UserForm getUserInfo() {
		return userInfo;
	}
	public void setUserInfo(UserForm userInfo) {
		this.userInfo = userInfo;
	}
	public boolean isNeedToLog() {
		return needToLog;
	}
	public void setNeedToLog(boolean needToLog) {
		this.needToLog = needToLog;
	}
	public String getNeedToSearch() {
		return needToSearch;
	}
	public void setNeedToSearch(String needToSearch) {
		this.needToSearch = needToSearch;
	}
	
	public BaseForm() {
		// TODO Auto-generated constructor stub
	}
	public BaseForm(boolean allDataFlag) {
		if(allDataFlag){
			this.rowsPerPage=-1;
		}
	}


	// 根据记录总数、每页记录数、当前页计算相关属性
	public void setRowCount(int a_rowCount) {
		this.rowCount = a_rowCount;
	}

	public void setRowsPerPage(int a_rowsPerPage) {
		this.rowsPerPage = a_rowsPerPage;
	}

	public void setCurrentPage(int a_currentPage) {
		this.currentPage = a_currentPage;
	}

	/**
	 * 返回所有记录数
	 * 
	 * @return
	 */
	public int getRowCount() {
		return this.rowCount;
	}

	/**
	 * 返回总页数
	 * 
	 * @return
	 */
	public int getPageCount() {
		return this.pageCount;
	}

	/**
	 * 返回每页的记录数
	 * 
	 * @return
	 */
	public int getRowsPerPage() {
		return this.rowsPerPage;
	}

	/**
	 * 返回当前页的页码
	 * 
	 * @return
	 */
	public int getCurrentPage() {
		return this.currentPage;
	}

	/**
	 * 返回当前分页的记录从那条开始的序号
	 * 
	 * @return
	 */
	public int getRowFrom() {
		return this.rowFrom;
	}

	/**
	 * 返回分页记录最后一条记录的序号
	 * 
	 * @return
	 */
	public int getRowTo() {
		return this.rowTo;
	}
	private List list; // 查询结果记录的列表

	private int toPage = 1; //

	public void setRowsperpage(int rowsperpage) {
		this.rowsPerPage = rowsperpage;
	}

	// 查询得到的列表
	public List getList() {

		return list;
	}

	public int getToPage() {
		return toPage;
	}

	public void setList(List list) {
		this.list = list;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public void setRowFrom(int rowFrom) {
		this.rowFrom = rowFrom;
	}

	public void setRowTo(int rowTo) {
		this.rowTo = rowTo;
	}

	public void setToPage(int toPage) {
		// this.currentPage=toPage;
		if(toPage<1){
			toPage = 1;
		}
		this.toPage = toPage;
	}
	public Serializable[] getDelId() {
		return delId;
	}
	public void setDelId(Serializable[] delId) {
		this.delId = delId;
	}
	public String getReturnUrl() {
		return returnUrl;
	}
	public void setReturnUrl(String returnUrl) {
		this.returnUrl = returnUrl;
	}
	
	

}
